package edu.ntu.im.p2ptrade.msg;

import edu.ntu.im.p2ptrade.P2PTrade;
import net.jxta.endpoint.Message;
import net.jxta.endpoint.StringMessageElement;

public class SearchItemQuery implements PMessage {
	public static final String QUERY = "query";
	private String queryStr;
	public SearchItemQuery( String queryStr){
		this.queryStr = queryStr;
		
	}

	public Message getMessageToTransfer() {
		Message msg = new Message();
		msg
		.addMessageElement(P2PTrade.getInstance().getAppName(),
				new StringMessageElement(TYPE,SearchItemQuery.class
						.getSimpleName(), null));
		msg
		.addMessageElement(P2PTrade.getInstance().getAppName(),
				new StringMessageElement(QUERY,this.queryStr, null));
		
		msg
		.addMessageElement(P2PTrade.getInstance().getAppName(),
				new StringMessageElement(PEER,P2PTrade.getInstance().getPeerName(), null));
		
		return msg;
	}

	public String toLogMessage() {
		// TODO Auto-generated method stub
		return null;
	}

}
